libxl: Do not trust frontend in libxl__devices_destroy
authorIan Jackson <ian.jackson@eu.citrix.com>
Tue, 3 May 2016 17:39:36 +0000 (18:39 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 2 Jun 2016 14:53:28 +0000 (15:53 +0100)
commite3d851340c551554b93743606f180bd310a55da8
tree70d3cc6e1b3068256a93fc27437264dcd5b7d68f
parent481dddb63b1fac2368c8e8be109babee0b1ca171
libxl: Do not trust frontend in libxl__devices_destroy

We need to enumerate the devices we have provided to a domain, without
trusting the guest-writeable (or, at least, guest-deletable) frontend
paths.

Instead, enumerate via, and read the backend path from, /libxl.

The console /libxl path is regular, so the special case for console 0
is not relevant any more: /libxl/GUEST/device/console/0 will be found,
and then libxl__device_destroy will DTRT to the right frontend path.

This is part of XSA-175.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
tools/libxl/libxl_device.c